Skip to main content

Import

Usage

Examples

Basic example of using the Media component to display an image:

Parameters

The component accepts the following props:

Supported Media Types

The Media component automatically detects and handles different types of content:
  • Images: Renders standard image files (PNG, JPG, GIF, etc.)
  • Videos: Supports video files with autoplay, loop, and controls
  • 3D Models: Renders 3D models using ModelViewer component
  • HTML: Displays HTML content in a sandboxed iframe

Features

Automatic Content Type Detection

The component automatically detects the content type of the asset and renders the appropriate element:

Fallback Chain

If an asset fails to load, the component will:
  1. Try the next asset in the assets array
  2. If all assets fail, display the custom fallback content
  3. If no fallback content is provided, show the default chess tile pattern

Loading States

The component includes built-in loading states:

Notes

The Media component is designed to handle various types of collectible assets with built-in:
  • Automatic content type detection
  • Fallback handling
  • Loading states
  • Safari compatibility adjustments
When using with video content, note that:
  • Videos autoplay by default
  • Videos are muted by default for autoplay compatibility